// 模拟后端动态生成路由
import { MockMethod } from "vite-plugin-mock";

/**
 * roles：页面级别权限，这里模拟二种 "admin"、"common"
 * admin：管理员角色
 * common：普通角色
 */

const permissionRouter = {
  path: "/permission",
  meta: {
    title: "menus.permission",
    icon: "lollipop",
    rank: 10
  },
  children: [
    {
      path: "/permission/page/index",
      name: "PermissionPage",
      meta: {
        title: "menus.permissionPage",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/permission/button/index",
      name: "PermissionButton",
      meta: {
        title: "menus.permissionButton",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    }
  ]
};

const nestedRouter = {
  path: "/nested",
  meta: {
    title: "多级菜单"
  },
  children: [
    {
      path: "/nested/menu1",
      meta: {
        title: "菜单1"
      },
      children: [
        {
          path: "/nested/menu1/menu1-1",
          meta: {
            title: "菜单1-1"
          },
          children: [
            {
              path: "/ceshiCD",
              name: "Menu1-1-1",
              meta: {
                title: "菜单1-1-1"
              }
            },
            {
              path: "/nested/menu1/menu1-1/menu1-1-2/index",
              name: "Menu1-1-2",
              meta: {
                title: "菜单1-1-2"
              }
            }
          ]
        }
      ]
    }
  ]
};

const productRouter = {
  path: "/product",
  meta: {
    title: "menus.hsproduct",
    icon: "Operation",
    rank: 10
  },
  children: [
    {
      path: "/product/classification",
      name: "Classification",
      meta: {
        title: "menus.hscategory",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/product/productdictionary",
      name: "Productdictionary",
      meta: {
        title: "menus.hsproductdictionary",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/product/list",
      name: "ProductList",
      meta: {
        title: "menus.hsproductlist",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    }
  ]
};

const applicationRouter = {
  path: "/application",
  meta: {
    title: "menus.hsapplicationcenter",
    icon: "PieChart",
    rank: 10
  },
  children: [
    {
      path: "/application/center",
      name: "ApplicationCenter",
      meta: {
        title: "menus.hsclassification",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/application/list",
      name: "ApplicationList",
      meta: {
        title: "menus.hsapplicationlist",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    }
  ]
};

const designsupportRouter = {
  path: "/designsupport",
  meta: {
    title: "menus.hsdesignandsupport",
    icon: "Scissor",
    rank: 10
  },
  children: [
    {
      path: "/designsupport/evaluationversion",
      name: "Evaluationversion",
      meta: {
        title: "menus.hsevaluationversion",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/designsupport/packaging",
      name: "Packaging",
      meta: {
        title: "menus.hswrapperfile",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/designsupport/simulationmodel",
      name: "Simulationmodel",
      meta: {
        title: "menus.hssimulationmodel",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/designsupport/supportsoftware",
      name: "Supportsoftware",
      meta: {
        title: "menus.hssupportedsoftware",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },

  ]
};

const qualityreliabilityRouter = {
  path: "/qualityreliability",
  meta: {
    title: "menus.hsreliability",
    icon: "Medal",
    rank: 10
  },
  children: [
    {
      path: "/qualityreliability/certificate",
      name: "Certificate",
      meta: {
        title: "menus.hsqualitycertificate",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/qualityreliability/qs",
      name: "Qs",
      meta: {
        title: "menus.hsqualitysystem",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/qualityreliability/reliabilityitem",
      name: "Reliabilityitem",
      meta: {
        title: "menus.hsreliabilityitem",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/qualityreliability/statement",
      name: "statement",
      meta: {
        title: "menus.hsenvironmentalstatement",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    }
  ]
};

const aboutusRouter = {
  path: "/aboutus",
  meta: {
    title: "menus.hsaboutus",
    icon: "School",
    rank: 10
  },
  children: [
    {
      path: "/aboutus/companyprofile",
      name: "Companyprofile",
      meta: {
        title: "menus.hscompanyprofile",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/aboutus/gloriesofcompany",
      name: "Gloriesofcompany",
      meta: {
        title: "menus.hsgloriescompany",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/aboutus/contactus",
      name: "Contactus",
      meta: {
        title: "menus.hsconnectus",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/aboutus/Informationlist",
      name: "Informationlist",
      meta: {
        title: "menus.hsinformationlist",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
  ]
};

const userRouter = {
  path: "/user",
  meta: {
    title: "menus.hsusercenter",
    icon: "Avatar",
    rank: 10
  },
  children: [
    {
      path: "/user/userlist",
      name: "Userlist",
      meta: {
        title: "menus.hsuserlist",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/user/blacklist",
      name: "Blacklist",
      meta: {
        title: "menus.hsblacklist",
        roles: ["admin", "common"]
      }
    }
  ]
};

const messageRouter = {
  path: "/message",
  name: "Message",
  meta: {
    icon: "ChatLineRound",
    title: "menus.hsmessageCenter",
    rank: 1
  },
  children: [
    {
      path: "/message",
      name: "Message",
      meta: {
        title: "menus.hsmessageCenter",
        roles: ["admin", "common"]
      }
    }
  ]
};

// const orderRouter = {
//   path: "/order",
//   name: "Order",
//   meta: {
//     icon: "GoodsFilled",
//     title: "menus.hsorderManagement",
//     rank: 2
//   },
//   children: [
//     {
//       path: "/order",
//       name: "Order",
//       meta: {
//         title: "menus.hsorderManagement",
//         roles: ["admin", "common"]
//       }
//     }
//   ]
// };

const orderRouter = {
  path: "/order",
  meta: {
    title: "订单管理",
    icon: "GoodsFilled",
    rank: 2
  },
  children: [
    {
      path: "/order/productorder",
      name: "Orderproductorder",
      meta: {
        title: "样品申请",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/order/pgborder",
      name: "Orderpgborder",
      meta: {
        title: "评估板订单",
        roles: ["admin", "common"]
      }
    },

  ]
};







const accountRouter = {
  path: "/account",
  name: "Account",
  meta: {
    icon: "Stamp",
    title: "menus.hsaccountManagement",
    rank: 3
  },
  children: [
    {
      path: "/account",
      name: "Account",
      meta: {
        title: "menus.hsaccountManagement",
        roles: ["admin", "common"]
      }
    }
  ]
};

const bannerRouter = {
  path: "/banner",
  name: "Banner",
  meta: {
    icon: "PictureFilled",
    title: "menus.hsbanner",
    rank: 3
  },
  children: [
    {
      path: "/banner",
      name: "Banner",
      meta: {
        title: "menus.hsbanner",
        roles: ["admin", "common"]
      }
    }
  ]
};




const shopRouter = {
  path: "/shop",
  meta: {
    title: "menus.hsshop",
    icon: "Briefcase",
    rank: 10
  },
  children: [
    {
      path: "/shop/productlist",
      name: "Shopproductlist",
      meta: {
        title: "menus.hsshopproductlist",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/shop/evaluationeditionlist",
      name: "Evaluationeditionlist",
      meta: {
        title: "menus.hsevaluationeditionlist",
        roles: ["admin", "common"]
      }
    },
    {
      path: "/shop/authorization",
      name: "Authorization",
      meta: {
        title: "menus.hsdealerlist",
        roles: ["admin", "common"]
      }
    }
  ]
};

const kbsRouter = {
  path: "/kbs",
  meta: {
    title: "知识库",
    icon: "EditPen",
    rank: 10
  },
  children: [
    {
      path: "/kbs/kbsClassify",
      name: "kbsClassify",
      meta: {
        title: "文章池分类",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
    {
      path: "/kbs/kbsList",
      name: "kbsList",
      meta: {
        title: "文章池列表",
        roles: ["admin", "common"]
      }
    }
  ]
};

const technologyRouter = {
  path: "/technology",
  meta: {
    title: "技术文档",
    icon: "Connection",
    rank: 10
  },
  children: [
    {
      path: "/technology/technologyClassify",
      name: "technologyClassify",
      meta: {
        title: "技术分类",
        roles: ["admin", "common"],
        auths: ["btn_add", "btn_edit", "btn_delete"]
      }
    },
  ]
};

export default [
  {
    url: "/getAsyncRoutes",
    method: "get",
    response: () => {
      return {
        success: true,
        // data: [permissionRouter, nestedRouter]
        data: [
          messageRouter,
          accountRouter,
          bannerRouter,
          // permissionRouter,
          productRouter,
          applicationRouter,
          designsupportRouter,
          qualityreliabilityRouter,
          aboutusRouter,
          userRouter,
          orderRouter,
          shopRouter,
          kbsRouter,
          technologyRouter
        ]
      };
    }
  }
] as MockMethod[];
